//
//  LTSRingSDK+Desc.m
//   CareRing
//
//  Created   on 2023/8/1.
//

#import "CARingSDK+Desc.h"

@implementation CARingSDK (Desc)

-(NSString *)cmdErrorDesc:(EXCUTED_CMD)cmd
{
    NSString *dec = @"";
    switch (cmd) {
        case EXCUTED_CMD_SET_SPORT_MODE:
        {
            dec = @"运动模式";
        }
            break;
        case EXCUTED_CMD_SYNC_TIME:
        {
            dec = @"时间同步";
        }
            break;
        case EXCUTED_CMD_GET_STEPS:
        {
            dec = @"获取计步";
        }
            break;
        case EXCUTED_CMD_GET_TEMPERATURE:
        {
            dec = @"获取体温";
        }
            break;
        case EXCUTED_CMD_HIS_DATA:
        {
            dec = @"历史数据";
        }
            break;
        case EXCUTED_CMD_HIS_COUNT:
        {
            dec = @"历史数据个数";
        }
            break;
        case EXCUTED_CMD_BIND:
        {
            dec = @"绑定解绑设备";
        }
            break;
        case EXCUTED_CMD_SPORT_MODE:
        {
            dec = @"运动模式";
        }
            break;
        case EXCUTED_CMD_CLEAR_HIS_DATA:
        {
            dec = @"清空设备历史记录";

        }
            break;
        default:
            break;
    }
    
    return dec;
}

// 0x80 回包解析子命令 开, 关等, sr28开始支持
+(NSNumber *)analyCmdRespSubCmd:(NSData *)originData 
{
    if (originData.length != 20) {
        return nil;
    }
    uint8_t *dataBytes = (uint8_t *)[originData bytes];
    uint8_t subCmd = dataBytes[6] ;
    
    return @(subCmd);
}

@end
